<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>

        div {
            display: flex;
            width: 600px;
            height: 400px;
            background-color: pink;
            /* 
            flex布局，默认子元素不换行,如果放不下会缩小子元素的宽度，放到父元素里面 
            flex-wrap：可以设置子元素是否换行
            nowrap：默认 不换行
            wrap：换行
            */
            flex-wrap: wrap;
        }
        span {
            width: 150px;
            height: 100px;
            background-color: skyblue;
            color: #fff;
            margin: 10px;
        }

    </style>

</head>
<body>
    <div>
        <span>1</span>
        <span>2</span>
        <span>3</span>
        <span>4</span>
        <span>5</span>
    </div>
</body>
</html>